//
// Created by Zhangwj on 2023/9/26.
//

#include "BlockItemNode.h"

std::unique_ptr<BlockItemNode> BlockItemNode::BlockItemParser(Parser &parser) {
    //BlockItem → Decl | Stmt
    std::unique_ptr<BlockItemNode> blockItemNode = std::make_unique<BlockItemNode>();
    if (parser.getLexType(0) == LexType::CONSTTK || parser.getLexType(0) == LexType::INTTK) {
        blockItemNode->Decl = DeclNode::DeclParser(parser);
    } else {
        blockItemNode->Stmt = StmtNode::StmtParser(parser);
    }
    return blockItemNode;
}
